package com.lcy.app.common.util;

import android.graphics.Color;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class ToastUtil {
    public static void error(AppCompatActivity appCompatActivity, String str) {
        Toast toast = Toast.makeText(appCompatActivity, str, Toast.LENGTH_LONG);
        //设置显示位置
        toast.setGravity(Gravity.TOP , 0, 10);
        TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
        v.setTextColor(Color.RED);
        toast.show();
    }

    public static void  info(AppCompatActivity appCompatActivity, String str){
        Toast toast = Toast.makeText(appCompatActivity, str, Toast.LENGTH_LONG);
        //设置显示位置
        toast.setGravity(Gravity.TOP , 0, 10);
        TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
        v.setTextColor(Color.BLACK);
        toast.show();
    }
}
